<template>
  <view
    class="content"
    :style="{
      'padding-top': height + 'px',
    }"
  >
    <view
      :style="{
        height: statusBarHeight + 'px',
      }"
    >
    </view>
    <view
      class="head"
      :style="{
        top: statusBarHeight + 'px',
      }"
    >
      <view class="head_left">
        <u-icon
          name="arrow-left"
          color="#444444"
          size="24"
          :bold="true"
          @click="toBack"
        ></u-icon>
      </view>
      <view class="text">内容详情</view>
      <view class="head_right">
        <!-- <collect></collect> -->
      </view>
    </view>

    <view class="list">
      <view
        class="list_item"
        @click="goPage(item)"
        v-for="(item, index) in list"
        :key="index"
        >{{ item.title }}</view
      >
      <view class="empty_view" v-if="list && list.length == 0">
        <image
          class="item_left_clickable"
          src="../../static/images/my/kong.png"
          mode=""
        ></image>
        <view >当前没有相关数据，请查看其他分类或功能。</view>
      </view>
    </view>
	<floatingBall></floatingBall>
  </view>
</template>
  
  <script>
import collect from "@/components/collect.vue"; // 收藏、
export default {
  components: {
    collect,
  },

  data() {
    return {
      statusBarHeight: 0,
      height: 0,
      list: [],
      type: "",
      user_id: "",
      name: "",
    };
  },
  onLoad(options) {
    this.type = options.type;
    this.user_id = options.user_id;
    this.name = options.name;
  },
  onShow: function () {
    this.getList();
  },
  created() {
    const statusBarHeight = uni.getSystemInfoSync(); // 获取手机状态栏高度

    this.statusBarHeight = statusBarHeight.statusBarHeight;
    this.$nextTick(() => {
      uni
        .createSelectorQuery()
        .select(".head")
        .boundingClientRect((data) => {
          this.height = data.height;
        })
        .exec();
    });
  },
  methods: {
    toBack() {
      uni.navigateBack({
        delta: 1,
      });
    },

    goPage(item) {
      if (this.type) {
        uni.navigateTo({
          url: `/pages/detail/flyDetail?type=my&detailType=wen&currentId=${item.id}&from=wei`,
        });
      } else {
        uni.navigateTo({
          url: `/pages/detail/flyDetail?detailType=wen&currentId=${item.id}&from=wei`,
        });
      }
    },
    getList() {
      this.$http
        .userWenxindao_zhangjie({ user_id: this.user_id, name: this.name })
        .then((res) => {
          console.log(res, "章节列表");
          this.list = res.data.list.data;
        })
        .catch((error) => {
          uni.$u.toast(error);
        });
    },
  },
};
</script>
  
  <style scoped lang="scss">
.content {
  box-sizing: border-box;
  .top {
    padding: 0 30rpx 80rpx 30rpx;
  }
}

.head {
  width: 100%;
  padding: 18rpx 30rpx 47rpx;
  position: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  z-index: 99;
  background: #ffffff;

  .head_left {
    position: absolute;
    left: 30rpx;
  }

  .head_right {
    position: absolute;
    right: 30rpx;
  }

  .text {
    font-size: 36rpx;
    font-family: PingFang SC-Bold, PingFang SC;
    font-weight: 400;
    color: #444444;
  }
}

.list {
  .list_item {
    font-size: 30rpx;
    color: #444444;
    padding: 0 30rpx;
    margin-top: 40rpx;
  }
}
.empty_view {
    margin-top: 300rpx;
    image {
      margin: 0 auto;
      width: 410rpx;
      height: 410rpx;
    }
    view {
      font-size: 30rpx;
      color: #d8d8d8;
      text-align: center;
    }
  }
</style>